import Vue from 'vue'
import VueRouter from 'vue-router'
// 导入登录组件
import Login from '@/views/Login'
// 导入layout组件
import Layout from '@/views/Layout'
// 导入搜索页面组件
import Search from '@/views/Search'
// 导入layout组件下的四个子组件
import Home from '@/views/Layout/Home'
import Question from '@/views/Layout/Question'
import Video from '@/views/Layout/Video'
import User from '@/views/Layout/User'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    { path: '/login', component: Login },
    {
      path: '/',
      component: Layout,
      // 配置子路由规则
      children: [
        { path: '/', component: Home },
        { path: '/question', component: Question },
        { path: '/video', component: Video },
        { path: '/user', component: User }
      ]
    },
    { path: '/search', component: Search }
  ]

})

export default router
